﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using Newtonsoft.Json;
using xuxuzhaozhao.Blog.XuAuthorize;

namespace xuxuzhaozhao.Blog.Controllers
{
    public class HomeController : Controller
    {
        
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";
            FormsAuthentication.SetAuthCookie("xuxuzhaozhao", false);
            return View();
        }

        [XuAuthorize]
        public object Login()
        {
            var user = (XuUser)System.Web.HttpContext.Current.User;
            return JsonConvert.SerializeObject(user);
        }
    }
}
